/**
 * Copyright (C) 2018-2019
 * All rights reserved, Designed By www.samfeng.com
 * 注意：
 * 本软件为www.samfeng.com开发研制，项目使用请保留此说明
 */
export let spec = []
export let attribute1 = []

export const tableOption = {
    dialogType: 'drawer',
    border: true,
    stripe: true,
    menuAlign: 'center',
    align: 'center',
    menuType: 'text',
    searchShow: false,
    excelBtn: true,
    printBtn: true,
    dialogWidth: '50%',
    selection: true,
    searchMenuSpan: 6,
    column: [      
        {
            label: '商品名称',
            prop: 'name',
            search: true,
            display: false
        },
        {
            label: '商品图片',
            prop: 'picUrls',
            width: 120,
            slot: true,
            display: false
        },
        {
            label: '卖点',
            prop: 'sellPoint',
            display: false
        },
        {
          label: '销售价',
          prop: 'salesPrice',
          slot: true,
          display: false
        },
        {
          label: '市场价',
          prop: 'marketPrice',
          display: false
        },
        {
          label: '成本价',
          prop: 'costPrice',
          display: false
        },
        {
          label: '库存',
          prop: 'stock',
          display: false
        },
        {
            label: '商品编码',
            prop: 'spuCode',
            search: true,
            sortable: true,
            display: false
        },

        {
            label: '虚拟销量',
            prop: 'saleNum',
            display: false
        },
        {
            label: '创建时间',
            prop: 'createTime',
            sortable: true,
            display: false,
            type: "datetime",
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
        },
        {
            label: '更新时间',
            prop: 'updateTime',
            display: false
        },
        {
            label: '是否上架',
            prop: 'status',
            type: 'radio',
            search: true,
            sortable: true,
            slot: true,
            display: false,
            dicData: [{
                label: '下架',
                value: '0'
            }, {
                label: '上架',
                value: '1'
            }]
        }
    ],
    group: [

        {
            icon: 'el-icon-goods',
            label: '基本信息',
            prop: 'group0',
            column: [
                {
                    label: '',
                    prop: 'headBnt',
                    display: true,
                    formslot: true,
                    labelWidth: '0'
                },
                {
                    label: '',
                    prop: 'productInfo',
                    formslot: true,
                    labelWidth: '0',
                    span: 24,
                    arrow: true
                },             
                {
                    label: '商品名称',
                    prop: 'name',
                    span: 24,
                    rules: [{
                        required: true,
                        message: '商品名称不能为空',
                        trigger: 'blur'
                    },{
                      max: 100,
                      message: '长度在不能超过100个字符'
                    }]
                },

              {
                label: '商品图片',
                prop: 'picUrls',
                listType: 'picture-card',
                dataType: 'string',
                type: 'upload',
                width: 250,
                rules: [{
                  required: false,
                  message: '图片不能为空',
                  trigger: 'change'
                }],
                canvasOption: {
                  text: 'samfeng',
                  ratio: 0.1
                },
                oss: 'ali',
                loadText: '附件上传中，请稍等',
                span: 24,
                tip: '只能上传jpg/png文件，且不超过50kb',
              },
              {
                label: '',
                prop: 'updateTime',
                formslot: true,
                hide: true,
                span:24,
            },
            ]
        },

        {
            label: '',
            prop: 'remark1',
            display: false,
            column: [               
                {
                    label: '描述',
                    prop: 'description',
                    formslot: true,
                    span: 12
                }]
        },

        {
            label: "",
            prop: "normal",
            display: true,
            column: [
                {
                    label: '商品编码',
                    prop: 'spuCode',
                    order:1,
                    rules: [{
                      max: 32,
                      message: '长度在不能超过32个字符'
                    }]
                },
                {
                    label: '销售价',
                    prop: 'salesPrice',
                    type: 'number',
                    order: 2,
                    rules: [
                      {
                        required: true,
                        message: '销售价必须填写',
                        trigger: 'blur'
                      }]
                },
                {
                    label: '市场价',
                    prop: 'marketPrice',
                    order: 3,
                },
                {
                    label: '成本价',
                    order: 4,
                    prop: 'costPrice'
                },
                {
                    label: '卖点',
                    prop: 'sellPoint',
                    order: 6,
                    span: 24,
                    rules: [{
                      max: 500,
                      message: '长度在不能超过500个字符'
                    }]
                },
                {
                    label: '是否上架',
                    prop: 'status',
                    type: 'radio',
                    order: 6,
                    rules: [{
                        required: true,
                        message: '请选择是否上架',
                        trigger: 'blur'
                    }],
                    dicData: [{
                        label: '下架',
                        value: '0'
                    }, {
                        label: '上架',
                        value: '1'
                    }]
                },
                {
                    label: '餐饮类别',
                    prop: 'pos',
                    display: true,
                    type: 'radio',
                    value: '0',
                    dicData: [{
                        label: '否',
                        value: '0'
                    }, {
                        label: '是',
                        value: '1'
                    }]
                }            
            ]
        },

        {
            label: "",
            prop: "stock",
            display: false,
            column: [
                {
                    label: '库存',
                    prop: 'stock',
                    type: 'number',
                    rules: [
                      {
                        required: true,
                        message: '库存必须填写',
                        trigger: 'blur'
                      }]
                },
                {
                    label: '虚拟销量',
                    prop: 'saleNum',
                    type: 'number',
                    tip: '可以按自己需求设置，系统会按销售情况自动累加'
                },
            ]
        },

        {
            label: "",
            prop: "sale",
            display: false,
            column: [
                {
                    label: '类目',
                    prop: 'categoryId',
                    type: 'cascader',
                    search: true,
                    props: {
                        label: 'name',
                        value: 'id',
                        checkStrictly: true,
                        expandTrigger: "hover"
                    },
                    dicUrl: '/product/productCategory/categoryTree',
                    display: true
                },
            ]
        },

        {
            label: "",
            prop: "attribute",
            display: false,
            column: [
                {
                    label: '产品属性',
                    prop: 'attribute1',
                    type: 'dynamic',
                    display: true,
                    span:24,
                    children: {
                      align: 'center',
                      headerAlign: 'center',
                      rowAdd:(done)=>{
                          done({
                            name:'默认值'
                          });
                      },
                      rowDel:(row,done)=>{
                        console.log(row)
                        done();
                      },
                      column: [
                        {
                            label: "属性名称",
                            prop: "name",
                            display: true,
                            rules: [{
                                required:true,
                                message: '请输入属性名称'
                            }]
                          },{
                            label: "附加价格",
                            prop: "attributePrice",
                            display: true,
                            value: 0
                          },{
                            label: "备注",
                            prop: "attributeDescription"
                          }
                      ]
                    }
                },
                {
                    label: '产品参数',
                    prop: 'spec',
                    type: 'dynamic',
                    display: true,
                    span:24,
                    children: {
                      align: 'center',
                      headerAlign: 'center',
                      rowAdd:(done)=>{
                          done({
                              name: "默认值"
                          });
                      },
                      rowDel:(row,done)=>{
                        done();
                      },
                      column: [
                        {
                            label: "产品规格",
                            prop: "name",
                            display: true
                          },{
                            label: "规格值",
                            prop: "value",
                            display: true
                          }
                      ]
                    }
                  },
            ]
        },    

    ]
}

export const tableOption2 = {
    selection: true,
    searchMenuSpan: 6,
    addBtn: false,
    menu: false,
    column: [      
        {
            label: '商品名称',
            prop: 'name',
            search: true,
        },
        {
            label: '商品编码',
            prop: 'spuCode',
            search: true,
        },
        {
          label: '销售价',
          prop: 'salesPrice',
        },
        {
          label: '市场价',
          prop: 'marketPrice',
        },
        {
          label: '成本价',
          prop: 'costPrice',

        },
        {
          label: '库存',
          prop: 'stock',
        },
    ],
}